FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["SmartMedicalRAG/src/SmartMedicalRAG.Api/SmartMedicalRAG.Api.csproj", "SmartMedicalRAG/src/SmartMedicalRAG.Api/"]
COPY ["SmartMedicalRAG/src/SmartMedicalRAG.Core/SmartMedicalRAG.Core.csproj", "SmartMedicalRAG/src/SmartMedicalRAG.Core/"]
COPY ["SmartMedicalRAG/src/SmartMedicalRAG.Infrastructure/SmartMedicalRAG.Infrastructure.csproj", "SmartMedicalRAG/src/SmartMedicalRAG.Infrastructure/"]
RUN dotnet restore "SmartMedicalRAG/src/SmartMedicalRAG.Api/SmartMedicalRAG.Api.csproj"
COPY . .
WORKDIR "/src/SmartMedicalRAG/src/SmartMedicalRAG.Api"
RUN dotnet build "SmartMedicalRAG.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "SmartMedicalRAG.Api.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SmartMedicalRAG.Api.dll"] 